<h1>Editing item</h1>

<% form_for(@item) do |f| %>
  <%= f.error_messages %>

  <p>
    <%= f.label :category %><br />
    <%= f.collection_select(:category_id, Category.find(:all), :id, :catename, {:prompt => "please select one category"}) %>
  </p>
  <p>
    <%= f.label :brand %><br />
    <%= f.collection_select(:brand_id, Brand.find(:all), :id, :brandname, {:prompt => "please select one brand"}) %>
  </p>
  <p>
    <%= f.label :name %><br />
    <%= f.text_field :name %>
  </p>
  <p>
    <%= f.label :detail %><br />
    <%= f.text_area :detail %>
  </p>
  <p>
    <%= f.label :price %><br />
    <%= f.text_field :price %>
  </p>
  <p>
    <%= f.label :quantity %><br />
    <%= f.text_field :quantity %>
  </p>
  <p>
    <%= f.label :bought_date %><br />
    <%= f.date_select :bought_date %>
  </p>
  <p>
    <%= f.label :expire_date %><br />
    <%= f.date_select :expire_date %>
  </p>
  <p>
    <%= f.submit "Update" %>
  </p>
<% end %>

<%= link_to 'Show', @item %> |
<%= link_to 'Back', items_path %>
